package cn.stylefeng.guns.modular.demos.service.impl;

import cn.stylefeng.guns.base.pojo.page.LayuiPageFactory;
import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
import cn.stylefeng.guns.modular.demos.entity.EduAttendanceInfo;
import cn.stylefeng.guns.modular.demos.mapper.EduAttendanceInfoMapper;
import cn.stylefeng.guns.modular.demos.model.params.EduCourseSelectionInfoParam;
import cn.stylefeng.guns.modular.demos.service.EduAttendanceInfoService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * TODO
 *
 * @author xuemeng
 * @version 1.0
 * @date 2023/12/23 16:37
 */
@Service
public class EduAttendanceInfoServiceImpl extends ServiceImpl<EduAttendanceInfoMapper, EduAttendanceInfo> implements EduAttendanceInfoService {

    @Autowired
    private EduAttendanceInfoMapper eduAttendanceInfoMapper;

    @Override
    public LayuiPageInfo findPageBySpec(EduCourseSelectionInfoParam param){
        Page pageContext = getPageContext();
        IPage page = this.baseMapper.customPageList(pageContext, param);
        return LayuiPageFactory.createPageInfo(page);
    }

    @Override
    public void deleteByRefKeyAndStuendId(String refKey, String studentId) {
        eduAttendanceInfoMapper.deleteByRefKeyAndStuendId(refKey,studentId);
    }

    private Page getPageContext() {
        return LayuiPageFactory.defaultPage();
    }

}
